<template>
  <div class="pages">
    <div class="user-header">
      <div class="portrait">
        <img
          v-if="userInfo.photo"
          class="avatar"
          :src="`${userInfo.photo}`"
          :alt="userInfo.consName"
        />
        <img
          v-else
          class="avatar"
          src="@/assets/mrtx.png"
        />
      </div>
      <div class="user-name">{{ userInfo.consName || '请登陆' }}</div>
    </div>
    <div class="score-box">
      <div class="score-num" @click="toScoreManagement">
        <p class="num">{{ userInfo.points ? this.toDecimalMark(Number(userInfo.points)) : '--' }}</p>
        <p class="txt">积分管理</p>
      </div>
      <div class="score-record" @click="toScoreRecord">
        <p class="num"><img src="@/assets/record.png" alt="" /></p>
        <p class="txt">兑换记录</p>
      </div>
    </div>
  </div>
</template>

<script>
export default {
  name: "UserHeader",
  props: {
    userInfo: {},
  },
  data() {
    return {};
  },
  created() {},
  methods: {
    toScoreManagement() {
      this.$router.push({ path: "/scoreManagement" });
    },
    toScoreRecord() {
      this.$router.push({ path: "/scoreRecord" });
    },
  },
};
</script>
<style scoped lang="less">
.user-header {
  display: flex;
  height: 104px;
  // padding-top: 32px;
  box-sizing: border-box;
  align-items: center;
  // justify-content:center;
  // align-content:center;
  .user-name {
    flex: 1;
    padding-left: 12px;
    font-size: 16px;
    font-weight: 700;
  }
  .portrait {
    .avatar {
      width: 56px;
      height: 56px;
      border: 2px solid #fff;
      border-radius: 50%;
    }
  }
}
.score-box {
  display: flex;
  padding: 16px 0;
  background: #fff;
  border-radius: 10px;
  text-align: center;
  div {
    flex: 1;
    .num {
      display: flex;
      height: 40px;
      font-size: 20px;
      color: #51afb1;
      font-weight: 700;
      align-items: center;
      justify-content: center;
    }
    .txt {
      font-size: 12px;
      color: #999;
    }
    &.score-record {
      img {
        width: 26px;
      }
      border-left: 1px solid #ebedf0;
    }
  }
}
</style>
